﻿
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Snowy.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Snowy.Extensions
{
    public static class SnowyExtension
    {
        internal static void AddSnowyConfigure(this IServiceCollection services, IConfiguration Configuration)
        {
            var settings = Configuration.Get<AppSettings>();
            services.AddScoped<UserService>();
            services.AddScoped<ClickWordCaptcha>();

            var healthChecks = services.AddHealthChecks();
            switch (settings.DataBase)
            {
                case DataBaseType.PostgreSql:
                default:
                    services.ConfigureNpgsql(Configuration.GetConnectionString("Snowy"), settings.DbContextPoolSize, healthChecks);
                    break;
            }
        }
    }
}
